#include <iostream>
#include <functional>
#include<cstdio>
using namespace std;
const string s = "+-*/%";
int MyMath(int x,int y,char op)
    {
        int result = 0;
        switch (op)
        {
        case '+':
            result = x + y;
            break;
        case '-':
            result = x - y;
            break;
        case '*':
            result = x * y;
            break;
        case '/':
        {
            if (y == 0)
            {
                cerr << "除0错误" << endl;
                result = -1;
                break;
            }
            result = x / y;
            break;
        }
        case '%':
            if (y == 0)
            {
                cerr << "除0错误" << endl;
                result = -1;
                break;
            }
            result = x % y;
            break;
        default:
            break;
        }
        return result;
    }

class CalTask
{
public:
    using func_t = function<int(int, int,char)>;
    CalTask()
    {}
    CalTask(int x, int y, char op,func_t func) : _x(x), _y(y), _op(op),_func(func)
    {}
    string operator()()
    {
        int result = _func(_x, _y,_op);
        char buffer[1024];
        snprintf(buffer,sizeof buffer,"%d %c %d = %d",_x,_op,_y,result);
        return buffer;
    }
    ~CalTask()
    {
    }
    string toTaskString()
    {
        char buffer[1024];
        snprintf(buffer,sizeof buffer,"%d %c %d = ?",_x,_op,_y);
        return buffer;
    }

private:
    int _x;
    int _y;
    char _op;
    func_t _func;
};
class SaveTask
{
public:
    using func_t = function<void(const string &)>;
    SaveTask(string message,func_t func):_message(message),_func(func)
    {}
    SaveTask()
    {}
    ~SaveTask()
    {}
    void operator()()
    {
        _func(_message);
    }
    
private:
    string _message;
    func_t _func;
};
template<class S,class C>
class BlockQueue
{
public:
    Block_Queue<S>* _sq;
    Block_Queue<C>* _cq;
};